package lucene.server.common.utils;

import lucene.server.common.task.ITask;


import java.util.concurrent.ConcurrentHashMap;

public class TaskUtil {
    private static ConcurrentHashMap<String, ITask> TASK_HANDLER_MAP = new ConcurrentHashMap<>();

   public static ITask getTask(String databaseName,String taskName){
       String key = "change_"+databaseName+"_"+taskName;

       if (TASK_HANDLER_MAP.containsKey(key)){
           return TASK_HANDLER_MAP.get(key);
       }else{
           return null;
       }
   }
   public static void addTask(String taskKey,ITask task){
        TASK_HANDLER_MAP.put(taskKey,task);
   }
}